package com.orhon.smartcampus.modules.material.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "material_buildings", schema = "smartcloud", catalog = "")
public class Buildings {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;
    
    @Column(name = "buildings_code", nullable = true, length = 20)
    private String buildingsCode;
    
    @Column(name = "unit_num", nullable = true)
    private Long unitNum;
    
    @Column(name = "floor_num", nullable = true)
    private Long floorNum;
    
    @Column(name = "buildings_status", nullable = false)
    private Integer buildingsStatus;
    
    @Column(name = "buildings_at", nullable = true)
    private Date buildingsAt;
    
    @Column(name = "buildings_years", nullable = true)
    private Integer buildingsYears;
    
    @Column(name = "buildings_tel", nullable = true, length = 11)
    private String buildingsTel;
    
    @Column(name = "buildings_use", nullable = true)
    private String buildingsUse;
    
    @Column(name = "buildings_cost", nullable = true, precision = 0)
    private Float buildingsCost;
    
    @Column(name = "buildings_area", nullable = true, precision = 0)
    private Float buildingsArea;
    
    @Column(name = "buildings_onarea", nullable = true, precision = 0)
    private Float buildingsOnarea;
    
    @Column(name = "deleted_at", nullable = true)
    private Date deletedAt;
    
    @Column(name = "created_at", nullable = true)
    private Date createdAt;
    
    @Column(name = "created_by", nullable = true)
    private Integer createdBy;
    
    @Column(name = "updated_at", nullable = true)
    private Date updatedAt;
    
    @Column(name = "updated_by", nullable = true)
    private Integer updatedBy;
    
    @Column(name = "buildings_name", nullable = true)
    private String buildingsName;
    
    @Column(name = "buildings_property", nullable = true)
    private String buildingsProperty;
    
    @Column(name = "buildings_material", nullable = true)
    private String buildingsMaterial;
    
    @Column(name = "bulidings_introduction", nullable = true)
    private String bulidingsIntroduction;


    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
    @JoinColumn(name = "site_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action=NotFoundAction.IGNORE)
    private Site site;
    
//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "campus_id", referencedColumnName = "id")
//    @Where(clause = "ISNULL(deleted_at)")
//    @NotFound(action=NotFoundAction.IGNORE)
//    private Campus materialCampusByCampusId;
//
//    @ManyToOne( cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//    @JoinColumn(name = "school_id", referencedColumnName = "id")
//    @Where(clause = "ISNULL(deleted_at)")
//    @NotFound(action=NotFoundAction.IGNORE)
//    private Schools baseSchoolsBySchoolId;
}
